/**
 * @file error.h
 * @author 王烨
 * @date 2011-01-05
**/

#ifndef ERROR_H_INCLUDED
#define ERROR_H_INCLUDED

#include <stdexcept>

#include "error_code.pb.h"

namespace skeleton
{
  /*RPC错误的基类*/
  class RPCError : public std::runtime_error
  {
  public:
    RPCError()
      :std::runtime_error("Unknown RPC error"){}
    RPCError(ErrorCode code, const std::string &detail)
      :std::runtime_error(detail), code(code){}
    ErrorCode getCode() const {return code;}
  private:
    ErrorCode code;
  };
}
#endif
